<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr1 = [1,2,3,4,5,6,7,8];
        let goodsList = [
            {name: 'apple', num: 1, isChecked: true},
            {name: 'banana', num: 1, isChecked: false},
            {name: 'tomato', num: 1, isChecked: true},
            {name: 'orange', num: 1, isChecked: true},
        ]
        // every  some  filter
        // every 数组中的每一项都符合条件就返回true，否则返回false
        // some 数组中的有一项符合条件就返回true，每一项都不符合才返回false
        let res1 = arr1.every(function(item) {
            return item>=4 // return后面的判断条件
        })
        console.log(res1);

        // 处理全选
        let res2 = goodsList.every(function(item) {
            return item.isChecked // return后面的判断条件
        })
        console.log('是否全选：', res2);
        let res3 = arr1.some(function(item) {
            return item > 50 // return后面的判断条件
        });
        console.log(res3);
    </script>
</body>
</html>